local config = require "config"
local controller = require "controller.admin"

local uri = ngx.var.uri
local regex = config.base_url..[[waf_admin/(\w+)]]
local m, err = ngx.re.match(uri,regex, "jo")

local function do_action(method, ...)
    local args = {...} or {}
    method(unpack(args))
end

if m then
    -- config import
    local fields= {logout=controller.logout, login=controller.login, index=controller.index}
    local view_method = fields[m[1]]
    ngx.log(ngx.ERR, config.in_html_template_dir)
    do_action(view_method, config.in_html_template_dir)
else
    return 
end
